home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue30 / bdeorx / BDEDORX.ZIP / Px7Tbl / PX7TABLE.TXT < prev   
Encoding:
Text File  |  1997-10-19  |  2.7 KB  |  84 lines

  1.  
  2. Px7Table is a TTable descendant with an added method to make use of 
  3. the new Pdox7 descending indices. With this type of index, you can
  4. determine the sortorder for every single field in the index.
  5.  
  6. ------------------------------------------------------------------
  7.  
  8. Installation: 
  9.  
  10. rename either PX7TABLE.D16 or D32 to PX7TABLE.DCR. Copy the files 
  11. to your directory for add-on compoments and add PX7TABLE.PAS to 
  12. your component library (see Delphi manuals for details).
  13.  
  14. ------------------------------------------------------------------
  15.  
  16. Added methods:
  17.  
  18. AddPx7Index works just like TTable.Addindex except for an
  19. additional string parameter named DescFields:
  20.  
  21.  procedure AddPx7Index(const Name,
  22.                        Fields,
  23.                        DescFields: string;
  24.                        Options: TIndexOptions);
  25.  
  26. With ixDescending in Options DescFields holds the list of fields
  27. that will actually be indexed descending, i.e. for a full
  28. descending index it equals the Fields parameter.
  29.  
  30. The following example creates an index that is descending on the
  31. 1st and 3rd and ascending on the 2nd field:
  32.  
  33.  Px7Table1.AddPx7Index('AscDescMix',
  34.                        'Field1;Field2;Field3',
  35.                        'Field1;Field3',
  36.                        [ixDescending]);
  37.  
  38. This one can be used to retrieve a list of descending fields in
  39. an index (useful for recreation of indices in code):
  40.  
  41.  function GetDescFields(const IxName: string): string;
  42.  
  43. It returns a string holding the fieldnames seperated by ';'.
  44.  
  45. ------------------------------------------------------------------
  46.  
  47.  procedure SetLevel(ALevel: string);
  48.  
  49. As it turned out that TUTILITY.DLL v2.52 (the one that ships with
  50. PfW7 for Win3.1x) not only drops indices when rebuilding a table
  51. but sets the table level back to 5, I added a method to set the
  52. table level. This call makes your Paradox table a level 7 table:
  53.  
  54.  Px7Table1.SetLevel('7');
  55.  
  56. NOTE the table has to be opened exclusive for this call.
  57.  
  58.  function GetLevel: string;
  59.  
  60. A GetLevel method was added for completeness. Both use strings
  61. for input/output.
  62.  
  63. ------------------------------------------------------------------
  64.  
  65. Note on the internals of setting desc indices...:
  66.  
  67. The sortorder of a field in the index is determined by setting the
  68. correspondent entry in IDXDesc.iUnUsed to 1 for descending or
  69. to 0 for ascending. There is one entry in iUnUsed for every field
  70. in IDXDesc.aiKeyFld (i.e. for every field in the key...). The arrays 
  71. for the above example would look like this:
  72.  
  73. aiKeyFld = (1,2,3);
  74. iUnUsed  = (1,0,1);
  75.  
  76. NOTE WIN32: abDescending is used instead of iUnUsed!
  77.  
  78. See the code for EncodePx7IndexDesc for more details.
  79.  
  80. Reinhard Kalinke
  81. [100417.3504@compuserve com]
  82. (c) 1996-97
  83.  
  84.